<template>
  <div class="app-container">
	<Table
	  ref="table"
	  :auto-featch="true"
	  :fetch-data="fetchData"
	  :options="options.table"
	  :useAction="false"
	>
      <template #default>
        <el-table-column
          label="措施分类1"
          align="center"
          key="measuresOne"
          prop="measuresOne"
        />
        <el-table-column
          label="措施子类"
          align="center"
          key="measuresTwo"
          prop="measuresTwo"
        />
        <el-table-column
          label="负责人部门"
          align="center"
          key="deptName"
          prop="deptName"
        />
        <el-table-column
          label="负责人名称"
          align="center"
          key="userName"
          prop="userName"
        />
      </template>
	</Table>
  </div>
</template>

<script setup>
import { watch } from "vue";
import Table from "@/components/Table/index.vue";
import { apis as APIS } from "@/api/fxfjgk/fxfxqd.js";
import formJson from "./inner.json";
import { useAsyncData, useFormJson } from "@/views/hooks/useAsyncData.js";
const props = defineProps({
  parentNode2: {
    type: Object,
    default: () => ({}),
  },
});
const cuoshi5Flag = ref(false);
const { proxy } = getCurrentInstance();
const userList = ref([]);
const cs2 = ref([]);
const deptTree = ref([]);
const ops = useFormJson(formJson, {
  sort: [],
  sortable: [],
});

const options = reactive({
  table: ops,
  formOps: ops.filter((i) =>
    [
      "measuresProject",
      "dangerEvent",
      "analysisUnit",
      "cuoshi1",
      "cuoshi2",
      "cuoshi3",
      "deptUserName",
    ].includes(i.prop)
  ),
});
const taskContentData = ref([]);

const table = ref();
const filterForm = ref({});
const {
  onSubmit,
  fetchData,
  handleEdit,
  handleAdd,
  handleDel,
  getList,
  form,
  queryParams,
  dialogType,
  handleExport,
} = useAsyncData({
  APIS,
  formJson,
  table,
  proxy,
  filterForm: filterForm.value,
  // plugSubmit,
});
watch(
  () => form.value.taskDuty,
  () => {
    taskData();
  }
);
watch(
  () => form.value.dutyTask,
  (val) => {
    if (val === "0") {
      cuoshi5Flag.value = false;
    } else {
      cuoshi5Flag.value = true;
    }
  }
);
const taskData = () => {
  // alert(123);
  // APIS.taskList({ dutyType: form.value.taskDuty }).then((res) => {
  //   taskContentData.value = res.rows;
  // });
};
	  // alert(JSON.stringify(filterForm));
watch(
  () => props.parentNode2,
  (val) => {
	  filterForm.value.checkUserNames = val.checkUserNames;
      getList();
  },
  {
    deep: true,
  }
);

</script>

<style lang="scss" scoped></style>
